<?php

namespace app\controller;

use app\service\PlanService;
use support\Request;
use support\Response;

class PlanController
{
    /**
     * @var PlanService
     */
    private $planService;

    public function __construct()
    {
        $this->planService = PlanService::getInstance();
    }

    /**
     * 按年月统计排期任务数量
     * @param Request $request
     * @return Response
     */
    public function totalYearMonthTaskNumCount(Request $request): Response
    {
        $param = $request->post();
        $res = $this->planService->totalYearMonthTaskNumCount($param['project_id'], $param['step_category_id'], $param['episode_id'], $param['start_time'], $param['end_time']);
        return json(success_response('', $res));
    }

    /**
     * 获取指定用户剧集列表
     * @param Request $request
     * @return Response
     */
    public function getUserEpisodeEntityList(Request $request): Response
    {
        $param = $request->post();
        $res = $this->planService->getUserEpisodeEntityList($param['user_ids'], $param['project_id'], $param['start_time'], $param['end_time']);
        return json(success_response('', $res));
    }

    /**
     * 获取排期剧集列表
     * @param Request $request
     * @return Response
     */
    public function getPlanStepCategoryEntityList(Request $request): Response
    {
        $param = $request->post();
        $res = $this->planService->getPlanStepCategoryEntityList($param['start_time'], $param['end_time'], $param['project_id'], $param['category_id_list']);
        return json(success_response('', $res));
    }


}
